home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / Erics C++ Libraries / Interface Classes / CPPScrollWindow.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  3.6 KB  |  115 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    10/19/93
  3.  
  4.     CLASS:  CPPScrollWindow
  5.     
  6.     SUPERCLASS: CPPWindow, CPPScrollArea
  7.     
  8.         This C++ class manages a window which has a scrolling area
  9.         inside of it
  10.     
  11. ********************************************************************/
  12.  
  13. #include <CPPScrollWindow.h>
  14. #include <Commands.h>
  15. #include <MathTools.h>
  16.  
  17.  
  18. /*-----------------------------------------------------------------*/
  19. /*------------------------ PUBLIC METHODS -------------------------*/
  20. /*-----------------------------------------------------------------*/
  21.  
  22.     CPPScrollWindow::CPPScrollWindow (CPPWindowManager *theManager, int ResID, 
  23.                               Boolean HScroll, Boolean VScroll, 
  24.                               short hStep, short vStep) :
  25.                 CPPWindow (theManager, ResID),
  26.                 CPPScrollArea ((CPPWindow *)this, HScroll, VScroll,
  27.                                hStep, vStep)
  28.     /* most of the work is done in the initialization phase */
  29.     {
  30.         SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
  31.                          kPageHeight + kSBarWidth);
  32.     }
  33.                          
  34. /*-----------------------------------------------------------------*/
  35.                      
  36.     CPPScrollWindow::CPPScrollWindow (CPPWindowManager *theManager,
  37.                               Rect *bounds, StringPtr title, Boolean isVisible,
  38.                               int windowKind, Boolean hasGoAway, int RefCon,
  39.                               Boolean HScroll, Boolean VScroll, 
  40.                               short hStep, short vStep) :
  41.                  CPPWindow (theManager, bounds, title, isVisible,
  42.                              windowKind, hasGoAway, RefCon),
  43.                  CPPScrollArea ((CPPWindow *)this, HScroll, VScroll, 
  44.                                  hStep, vStep)
  45.     /* most of the work is done in the initialization phase */
  46.     {
  47.         SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
  48.                          kPageHeight + kSBarWidth);
  49.     }
  50.  
  51. /*-----------------------------------------------------------------*/
  52.  
  53.     CPPScrollWindow::~CPPScrollWindow (void)
  54.     {
  55.     
  56.     }
  57.  
  58. /*-----------------------------------------------------------------*/
  59.  
  60.     char    *CPPScrollWindow::ClassName (void)
  61.     {
  62.         return "CPPScrollWindow";
  63.     }
  64.  
  65. /*-----------------------------------------------------------------*/
  66.  
  67.     Boolean    CPPScrollWindow::DoCommand (short commandID)
  68.     /* the default method sends the command to the target of the */
  69.     /* window. */
  70.     /* SUBCLASS SHOULD OVERRIDE */
  71.     {
  72.         return CPPScrollArea::DoCommand(commandID);
  73.     }
  74.  
  75. /*-----------------------------------------------------------------*/
  76. /*---------------------- PROTECTED METHODS ------------------------*/
  77. /*-----------------------------------------------------------------*/
  78.     
  79.     void    CPPScrollWindow::DoUserClick (EventRecord *theEvent)
  80.     /* instance specific handler for clicking in the window */
  81.     /* SUBCLASS SHOULD OVERRIDE */
  82.     {
  83.         CPPScrollArea::DoClick (theEvent);    // scrollarea object method
  84.     }
  85.  
  86. /*-----------------------------------------------------------------*/
  87.  
  88.     void    CPPScrollWindow::DoUserUpdate (void)
  89.     /* instance specific handler for drawing the window's contents */
  90.     /* SUBCLASS SHOULD OVERRIDE */
  91.     {
  92.         this->Draw();    // scrollarea object method
  93.     }
  94.  
  95. /*-----------------------------------------------------------------*/
  96.  
  97.     void    CPPScrollWindow::DoUserIdle (void)
  98.     /* instance specific handler for idling when the window is */
  99.     /* the frontmost window */
  100.     /* SUBCLASS SHOULD OVERRIDE */
  101.     {
  102.         if (this->WisActive)
  103.           CPPScrollArea::DoIdle();    // textedit object method
  104.     }
  105.  
  106. /*-----------------------------------------------------------------*/
  107.  
  108.     void    CPPScrollWindow::DoUserChangeSize (short newWidth, short newHeight)
  109.     /* instance specific handler for resizing the window; use this */
  110.     /* opportunity to change the size of the scrollbars and TE area */
  111.     {
  112.         CPPScrollArea::Resize (newWidth, newHeight);    // textedit object method
  113.     }
  114.  
  115.